import time
from appium import webdriver

# com.android.launcher3/.Launcher   锁屏页面
from appium.webdriver.common.touch_action import TouchAction

de = dict()
de['platformName'] = 'Android'
de['platformVersion'] = '5.1'
de['deviceName'] = '192.168.247.101:5555'
de['appPackage'] = 'com.android.launcher3'
de['appActivity'] = '.Launcher'
driver = webdriver.Remote('http://localhost:4723/wd/hub')
driver.implicitly_wait(3)
# 1》向上滑动
# 1.1先获取屏幕宽度
window_size = driver.get_window_size()
# print(window_size)
time.sleep(3)
driver.swipe(window_size['width'] * 0.5, window_size['height'] * 0.9,
             window_size['width'] * 0.5, window_size['height'] * 0.2)
time.sleep(3)
# 2》图案解锁
TouchAction(driver).press(x=217, y=430).move_to(x=300, y=430) \
    .move_to(x=380, y=430).move_to(x=382, y=511).release().perform()

time.sleep(3)
driver.quit()
